	Ext.BLANK_IMAGE_URL = "../script/ext-2.0.2/resources/images/default/s.gif"; 
	var password = new Ext.form.TextField({
			fieldLabel:'原始密码',
			id: 'password',
			minLength: 6,
			maxLength: 10,
			inputType: 'password',
			allowBlank: false
		});
	var passwordNew = new Ext.form.TextField({
			fieldLabel:'新密码',
			id: 'passwordNew',
			minLength: 6,
			maxLength: 10,
			inputType: 'password',
			allowBlank: false
		});
	var passwordTemp = new Ext.form.TextField({
			fieldLabel:'重复新密码',
			id: 'passwordTemp',
			minLength: 6,
			maxLength: 10,
			vtype: 'repetition',
			repetition: { targetCmpId: 'passwordNew' },
			inputType: 'password',
			allowBlank: false
		});
		
	var fp = new Ext.FormPanel({
			frame: true,
			autoScroll : true,
			width : 400,
			autoHeight: true,
			title: '修改密码',
			labelWidth: 90,
			labelAlign: 'right',
			defaults: {
				width: 150
			},
	        items: [password,passwordNew,passwordTemp],
	        buttons:[{
						text:'修改密码',
						iconCls:'yes',
						listeners:{
							click: function(){
								changePwd();
							}
						}
					}] 
    		});
	
	function changePwd(){
			var password1 = password.getValue();
			password1 = password1.replace(/(^\s*)|(\s*$)/g, ""); // 去前后空格
		    var password2 = passwordNew.getValue();
		    password2 = password2.replace(/(^\s*)|(\s*$)/g, ""); // 去前后空格
		    var password3 = passwordTemp.getValue();
		    password3 = password3.replace(/(^\s*)|(\s*$)/g, ""); // 去前后空格
		    
		    Ext.Msg.getDialog().setWidth(500); // 设置提示框输入宽度
		    
		    if (password1.length==0){
		    	Ext.Msg.alert('提示','请输入原始密码！');
		    	return false;
		    }else if (password1.length < 6 || password1.length > 10){
		    	Ext.Msg.alert('提示','密码长度为6-10位，请重新输入密码！');
		    	return false;
		    }
		    if (password2.length==0){
		    	Ext.Msg.alert('提示','请输入新密码！');
		    	return false;
		    }else if (password2.length < 6 || password2.length > 10){
		    	Ext.Msg.alert('提示','密码长度为6-10位，请重新输入新密码！');
		    	return false;
		    }
		    if (password3.length==0){
		    	Ext.Msg.alert('提示','请输入确认密码！');
		    	return false;
		    }else if (password3.length < 6 || password3.length > 10){
		    	Ext.Msg.alert('提示','密码长度为6-10位，请重新输入确认密码！');
		    	return false;
		    }
		    
		    if(fp.form.isValid()){
			    Ext.Msg.confirm().getDialog().setWidth(500);
			    Ext.Msg.confirm('提示', "原密码 = " + password1 + "<br>"
			        + "新密码 = " + password3 + "<br>"
			        + "确定要修改密码?", ccallBack);
			    function ccallBack(id) {
					if (id == "yes") {
						//发起Ajax请求
						Ext.Ajax.request({
							url:'passwordInfo!changePassword.action?dateTime='+new Date().getTime(),
							params:{
								passOld:password1,
								passNew:password3
							},
							success:function(response, options){
								var response = Ext.util.JSON.decode(response.responseText);
								if(response.success){
				                	ZANY.util.Msg('信息',"修改修改成功！");
				                	fp.form.reset();
								}else if(!response.success){
									ZANY.util.Msg('信息',"密码修改失败，如有问题请联系系统管理员！"+response.msg);  
								}             
							}
						});
					} else if (id == "no") {
	
					}
				}
		    }
		}
	
	Ext.apply(Ext.form.VTypes, {  
		     repetition: function(val, field) {     //返回true，则验证通过，否则验证失败  
		         if (field.repetition) {               //如果表单有使用repetition配置，repetition配置是一个JSON对象，该对象提供了一个名为targetCmpId的字段，该字段指定了需要进行比较的另一个组件ID。  
		             var cmp = Ext.getCmp(field.repetition.targetCmpId);   //通过targetCmpId的字段查找组件  
		             if (Ext.isEmpty(cmp)) {      //如果组件（表单）不存在，提示错误  
		                 Ext.MessageBox.show({  
		                     title: '错误',  
		                     msg: '发生异常错误，指定的组件未找到',  
		                     icon: Ext.Msg.ERROR,  
		                     buttons: Ext.Msg.OK  
		                 });  
		                 return false;  
		             }  
		             if (val == cmp.getValue()) {  //取得目标组件（表单）的值，与宿主表单的值进行比较。  
		                 return true;  
		             } else {  
		                 return false;  
		             }  
		         }  
		     },  
		     repetitionText: '两次输入的密码不一致！'  
		 });  
		 
	Ext.onReady(function(){
		Ext.QuickTips.init(); 
	　　 Ext.form.Field.prototype.msgTarget = 'side';
		var port = new Ext.Viewport({
				layout : 'fit',
				frame : true,
				items : [this.fp]
	    	});
	})
	